#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n = 0;
	int i = 0;
	int j = 0;
	int ret = 1;
	scanf("%d", &n);
	int arr[n][n];
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf("%d ", &arr[i][j]);
		}
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < i; j++)
		{
			if (arr[i][j] != 0)
			{
				ret = 0;
				goto end;
			}
		}
	}
end:
	if (ret == 0)
		printf("NO\n");
	else
		printf("YES\n");
	return 0;
}